//
//  Common.h
//  GoldArrow



#import <Foundation/Foundation.h>


#define COM [Common sharedInstance]

#pragma mark - Common公共类
/**
 * Common公共类
 */
@interface Common : NSObject

@property (nonatomic,strong) NSString *typeString; //判断是在学习考试界面还是党务挂历
@property (nonatomic) NSInteger index; //判断党务管理滑动到第几页
@property (nonatomic,strong) NSString *productID; //产品流程录入列表id
@property (nonatomic,strong) NSString *pushString; //推送的字符串
@property (nonatomic,strong) NSString *nameID; //定位跟踪筛选d部门id
@property (nonatomic,strong) NSArray *loactionArray; //定位跟踪筛选d部门id
@property (nonatomic,strong) NSArray *noLoactionArray; //定位跟踪筛选d部门id
@property (nonatomic,assign) BOOL isShaiXuan; //定位跟踪筛选d部门id
@property (nonatomic,strong) NSString *isAllSelect; //是否选择了全部
//app通用框架
@property (nonatomic,strong) NSArray *childArray; //tabbarITEM
@property (nonatomic,assign) NSInteger selectBarItem;  //选择barItem
@property (nonatomic,strong) NSString *isHiddenTab; //tabbarITEM
@property (nonatomic,strong) NSString *barURLString; //babbar底部链接



/**
 *  Common类的单例实例
 */
+ (Common *)sharedInstance;

- (NSString *) md5: (NSString *) inPutText;

/**
 *  判断字符串是否为空字符
 */
- (BOOL) isBlankString:(NSString *)string;

/**
 * 检测邮箱是否正确
 *@param  email 邮箱地址
 *@return 是否为邮箱
 */
- (BOOL)checkIsEmail:(NSString *)email;

/**
 * 检测是否只包含数字
 *@param  digital 检测字符串
 *@return 是否只包含数字
 */
- (BOOL)checkIsdigital:(NSString *)digital;
/**
 * 检测密码格式
 *@param  str 检测字符串
 *@return 是否正确
 */
- (BOOL)checkPassword:(NSString *)str;



/**
 * 检测用户名密码格式
 *@param  str 检测字符串
 *@return 是否正确
 */
- (BOOL)checkUserName:(NSString *)str;

/**
 * 检测是否包含空格
 *@param  str 检测字符串
 *@return 是否包含
 */
- (BOOL)checkContainSpce:(NSString *)str;

//邮箱
+ (BOOL) validateEmail:(NSString *)email;
//手机号码验证
+ (BOOL) validateMobile:(NSString *)mobile;
//车牌号验证
+ (BOOL) validateCarNo:(NSString *)carNo;
//车型
+ (BOOL) validateCarType:(NSString *)CarType;
//用户名
+ (BOOL) validateUserName:(NSString *)name;
//密码
+ (BOOL) validatePassword:(NSString *)passWord;
//昵称
+ (BOOL) validateNickname:(NSString *)nickname;
//身份证号
+ (BOOL) validateIdentityCard: (NSString *)identityCard;
//银行卡
+ (BOOL) validateBankCardNumber: (NSString *)bankCardNumber;
//银行卡后四位
+ (BOOL) validateBankCardLastNumber: (NSString *)bankCardNumber;
//CVN
+ (BOOL) validateCVNCode: (NSString *)cvnCode;
//month
+ (BOOL) validateMonth: (NSString *)month;
//month
+ (BOOL) validateYear: (NSString *)year;
//verifyCode
+ (BOOL) validateVerifyCode: (NSString *)verifyCode;
///获取当前日期
//获取当前时间日期

- (NSString *)currentTimeYYMMDDHHMMSS;
- (NSString *)currentTimeYYMMDD;

#pragma mark - URL编码
/**
 *  URL编码，http请求遇到汉字的时候，需要转化成UTF-8
 *
 *  @param urlString 需要编码的URL字符串
 *
 *  @return 编码的字符串
 */
- (NSString *)urlCodingToUTF8ByUrlString:(NSString *)urlString;


#pragma mark - URL解码
/**
 *  URL解码，URL格式是 %3A%2F%2F 这样的，则需要进行UTF-8解码
 *
 *  @param utf8String 需要解码的URL字符串
 *
 *  @return 解码的字符串
 */
- (NSString *)urlDecodingToUrlStringByUTF8String:(NSString *)utf8String;

#pragma mark - 私有方法
/**
 *  将NSDictionary中的Null类型的项目转化成@""
 */
+(NSDictionary *)nullDic:(NSDictionary *)myDic;

/**
 *  将NSDictionary中的Null类型的项目转化成@""
 */
+(NSArray *)nullArr:(NSArray *)myArr;

/**
 *  将NSString类型的原路返回
 */
+(NSString *)stringToString:(NSString *)string;

/**
 *  将Null类型的项目转化成@""
 */
+(NSString *)nullToString;

#pragma mark - 公有方法
/**
 *  类型识别:将所有的NSNull类型转化成@""
 */
+(id)changeType:(id)myObj;

/**
 *  json格式的字符串 转成 我们所需要的dict
 */
+ (NSDictionary *)dictionaryWithJsonString:(NSString *)jsonString;

/**
*  id类型转NSDictionary
*/
+ (NSDictionary*)getObjectData:(id)objj;
+ (id)getObjectInternal:(id)obj;
@end
